This invention relates to a method and an apparatus for arithmetic processing.
Some arithmetic processing apparatuses use convergence-type arithmetic operations which can derive a solution of a functional equation at a high speed. For example, division and calculation of a square root can be performed by repeating additions and multiplications in accordance with Newton's method.
By using Newton's method, the division "Z=X/Y" can be performed as follows. A first approximate value R.sub.o of 1/Y is determined by referring to a table. Then, an approximate solution R.sub.n of 1/Y is calculated by repeatedly using the following recurrence formula "n" times. EQU R.sub.i =R.sub.i-1 (2-R.sub.i-1 Y) (1)
Finally, an approximate value of X/Y can be obtained by multiplying R.sub.n and X.
In addition, by using Newton's method, the square root calculation "Y=X.sup.1/2 " can be performed as follows. A first approximate value R.sub.o of 1/X.sup.1/2 is determined by referring to a table. Then, an approximate solution R.sub.n of 1/X.sup.1/2 is calculated by repeatedly using the following recurrence formula "n" times. EQU R.sub.i =(1/2)R.sub.i-1 (3-R.sub.i-1.sup.2 X) (2)
Finally, an approximate value of X.sup.1/2 can be obtained by multiplying R.sub.n and X.
In prior art methods of arithmetic operation, an approximate value having a necessary accuracy is calculated as mentioned previously, and a final result is obtained by directly rounding the approximate value to a predetermined number of significant digits in a designated rounding mode.
The rounding is of various types. For example, IEEE754 floating-point standards prescribe the following four rounding modes: "round to nearest", "round toward +infinity", "round toward -infinity", and "round toward zero".
Accurately rounding requires information representing good values of digits in places equal to and above the place immediately lower than the lowest place of significant digits, and also information representing whether or not values of digits in places equal to and below the place lower than the lowest place of the significant digits by two places are zero. In such arithmetic operation of deriving an approximate solution of a functional equation as mentioned previously, although a maximal error can be predicted by a calculation algorithm and a used hardware, an error between the approximate solution value and an infinitely precise value can not be known.
Therefore, cases related to the approximate solution value and the infinitely precise value respectively may be different from each other in information representing values of digits in places equal to and above the place immediately lower than the lowest place of significant digits and also representing whether or not values of digits in places equal to and below the place lower than the lowest place of the significant digits by two places are zero. This means that a result obtained by directly rounding an approximate solution value is sometimes different from a result obtained by rounding an infinitely precise value. As the accuracy of the approximate solution value is increased, there is a less possibility that the result obtained by rounding the approximate solution value is different from the result obtained by rounding the infinitely precise value. In general, increasing the accuracy of the approximate solution value needs a longer calculation time or a larger number of digits handled by a hardware.